import java.io.*;



public class ViewMarks {

	    
	    @SuppressWarnings("deprecation")
		public static void printMarkSheet(String studentId,String assignmentName,String subjectId)
	    {
	    	File file=new File("markDetails_"+subjectId+"_"+assignmentName+"_"+studentId+".txt");
	    	FileInputStream fis = null;
	        BufferedInputStream bis = null;
	        DataInputStream dis = null;
	        
	    	PrintWriter saveFile=null;
	    	try
	    	{
	    		
	    		saveFile=new PrintWriter(new FileWriter(new File("markSheet_"+subjectId+"_"+assignmentName+"_"+studentId+".txt")));
	    	}
	    	catch(IOException e)
	    	{
	    		System.out.println(e);
	    	}
	    	saveFile.println("Provisional Marks for:");
	    	saveFile.println("Subject: "+subjectId);
	    	saveFile.println("Assessment: "+assignmentName);
	    	saveFile.println("Student: "+studentId);
	    	saveFile.println(assignmentName + " submitted on " + "08-10-2008 08:00:00");
	    	
	    	
	    	 try
	    	 {
	    	      fis = new FileInputStream(file);

	    	      // Here BufferedInputStream is added for fast reading.
	    	      bis = new BufferedInputStream(fis);
	    	      dis = new DataInputStream(bis);

	    	      // dis.available() returns 0 if the file does not have more lines.
	    	      while (dis.available() != 0)
	    	      {

	    	      // this statement reads the line from the file and print it to
	    	        // the console.
	    	        saveFile.println(dis.readLine());
	    	    	  
	    	      }

	    	      // dispose all the resources after using them.
	    	      fis.close();
	    	      bis.close();
	    	      dis.close();

	    	 }
	    	 catch (FileNotFoundException e)
	    	 {
	    	      e.printStackTrace();
	    	 }
	    	 catch (IOException e)
	    	 {
	    	      e.printStackTrace();
	    	 }
	    	 
	    	
	    	
	    	saveFile.close();
	    	
	    	
	    	
	    }
}
